#pragma once
#ifndef _CSEARCHRESPONSEPACKET_H_
#define _CSEARCHRESPONSEPACKET_H_

#include "structs.h"

class CSearchResponsePacket //: public CBasicPacket
{
private:
	char* data;
	char* dataEnciphered;
	char key[24];

	char cKey[4];

	unsigned char numEntries;
	unsigned short endOfData;

	unsigned char lastPacket;

	struct seaResponseEntry entries[20];
	unsigned char entrySize[20];

	unsigned short totalPlayersFound;

	unsigned int size;
	void encipher(void);
	void generateData(void);

public:
	
	CSearchResponsePacket(void);
	~CSearchResponsePacket(void);

	void calculateSize(void);

	void setLastPacket(bool value);

	char* getData(void);
	char* getDataEnciphered(void);
	void setNumberOfPlayersFound(unsigned short numFound);

	void setEntry(unsigned char entryNum,struct seaResponseEntry* newEntry);
	void setNumberOfEntries(unsigned char newNum);

	char* getKey(void);
	void setKey(char* newKey);

	unsigned int getSize(void);

	//for debugging
	void parseData(void);
	void setData(char* newData,unsigned short length);
	void dumpPacket(int filenum);
};

#endif